<!--
 * @FilePath     : /layui/demo/1575.html
 * @Description  : 2）远程数据动态赋值；
 * @Date         : 2025-02-24 16:29
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-02-24 16:36
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="demo1" class="xm-select-demo"></div>

    <script src="/axios/axios.min.js"></script>
    <script src="/xm-select/dist/xm-select.js"></script>
    <script>
      var demo1 = xmSelect.render({
        el: '.xm-select-demo',
        data: [],
        toolbar: {
          show: true,
        },

        //
      })

      /*
      初始数据为空；
      从接口，动态渲染一份数据；
      */
      axios({
        url: '/layui/xm-selects/remote-search1',
        method: 'GET',
      })
        .then(res => {
          console.log('获取远程数据-成功', res)
          const { data } = res.data
          demo1.update({
            data,
          })
        })
        .catch(err => {
          console.log('数据获取失败')
        })
    </script>
  </body>
</html>
